<template>
  <v-app>
    <ErrorPage v-if="code" :code="code" :msg="msg" :url="url" />
    <DefaultHomePage v-else />
  </v-app>
</template>

<script lang="ts" setup>
import { useSystemStateListener } from '@/composables/useSystemStateListener'
import { getAllUrlParams } from '~shared/utils/urlUtils'
import DefaultHomePage from './components/DefaultHomePage.vue'
import ErrorPage from './components/ErrorPage.vue'

// 启动系统状态监听器
useSystemStateListener()

// 获取URL参数
const url = ref('')
const code = ref('')
const msg = ref('')

onMounted(() => {
  const params = getAllUrlParams(window.location.href)

  url.value = params.url || ''
  code.value = params.code || ''
  msg.value = params.msg || ''
})
</script>
